<?xml version="1.0" encoding="windows-1252"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
<!-- INTERFACE -->
    <composite:interface>
        <composite:actionSource name="addButton" targets="form:addButton"/>
        <composite:attribute name="addButtonText" default="Add airport" required="true"/>
        <composite:attribute name="headerPrompt"/>
        <composite:attribute name="textPrompt"/>
        <composite:attribute name="airplanePrompt"/>
        <composite:attribute name="fromDestinationPrompt"/>
        <composite:attribute name="fromAirportPrompt"/>
        <composite:attribute name="toDestinationPrompt"/>
        <composite:attribute name="toAirportPrompt"/>
        <composite:attribute name="pricePrompt"/>
        <composite:attribute name="startDatePrompt"/>
        <composite:attribute name="startTimePrompt"/>
        <composite:attribute name="endDatePrompt"/>
        <composite:attribute name="endTimePrompt"/>
        <composite:attribute name="startDatePrompt"/>
        <composite:attribute name="managedBean"/>
    </composite:interface>

    <!-- IMPLEMENTATION, the cc's below are predefined-->
    <composite:implementation>
       <h:form id="form" prependId="false"
                onsubmit="return checkForm(this, '#{cc.clientId}')">
            <h1>#{cc.attrs.headerPrompt}</h1>
            <div class="prompt">
                #{cc.attrs.textPrompt}
            </div>
            <h:panelGrid columns="2">
                #{cc.attrs.airplanePrompt}
                <h:selectOneMenu id="airplane_select" value="#{cc.attrs.managedBean.selectedAirplane}">
                    <f:selectItems value="#{cc.attrs.managedBean.airplaneList}" />
                </h:selectOneMenu>
                #{cc.attrs.fromDestinationPrompt}
                <h:selectOneMenu  id="fromDestination_select" value="#{cc.attrs.managedBean.selectedFromDest}">
                    <f:ajax event="change" render="fromAirport_select fromAirport_selectItems" />
                    <f:selectItems value="#{cc.attrs.managedBean.destinationList}" />
                </h:selectOneMenu>
                #{cc.attrs.fromAirportPrompt}
                <h:selectOneMenu id="fromAirport_select" value="#{cc.attrs.managedBean.selectedFromAirport}">
                    <f:selectItems id="fromAirport_selectItems" value="#{cc.attrs.managedBean.fromAirportList}" />
                </h:selectOneMenu>
                #{cc.attrs.toDestinationPrompt}
                <h:selectOneMenu  id="toDestination_select" value="#{cc.attrs.managedBean.selectedToDest}">
                    <f:ajax event="change" render="toAirport_select toAirport_selectItems" />
                    <f:selectItems value="#{cc.attrs.managedBean.destinationList}" />
                </h:selectOneMenu>
                #{cc.attrs.toAirportPrompt}
                <h:selectOneMenu id="toAirport_select" value="#{cc.attrs.managedBean.selectedToAirport}">
                    <f:selectItems id="toAirport_selectItems" value="#{cc.attrs.managedBean.toAirportList}" />
                </h:selectOneMenu>
                #{cc.attrs.pricePrompt}
                <h:inputText id="price" value="#{cc.attrs.managedBean.price}"/>
                #{cc.attrs.startDatePrompt}
                <p:calendar value="#{cc.attrs.managedBean.startDate}" showOn="button" /> 
                #{cc.attrs.startTimePrompt}
                <h:inputText id="startTime" value="#{cc.attrs.managedBean.startTime}"/>
                #{cc.attrs.endDatePrompt}
                <p:calendar value="#{cc.attrs.managedBean.endDate}" showOn="button" />
                #{cc.attrs.endTimePrompt}
                <h:inputText id="endTime" value="#{cc.attrs.managedBean.endTime}"/>
            </h:panelGrid>
            <span>
                <h:commandButton id="addButton"
                                 value="#{cc.attrs.addButtonText}"
                                 actionListener="#{cc.attrs.managedBean.addFlight}"
                                 action="#{cc.attrs.managedBean.navigate}"/>
            </span>
        </h:form>
        <div class="error">
            <h:messages layout="table"/>
        </div>
    </composite:implementation>
</html>